#pragma once

#include <MCF/Code/StdMCF.hpp>
#include <MCF/Code/WindowBaseClass.hpp>

class AsyncWriteTextControlClass : public MCF::WindowBaseClass {
private:
	enum : UINT {
		_MSG_UPDATETEXT = WM_USER + 0x1000
	};
private:
	MCF::CriticalSection _m_csLock;
	MCF::TString _m_strNewText;
	volatile long _m_lInvalidated;
public:
	AsyncWriteTextControlClass();
	~AsyncWriteTextControlClass();
protected:
	virtual LRESULT _OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
public:
	void SetText(LPCTSTR lpszSetToWhich);
	void SetText(const MCF::TString &strSetToWhich);
	void SetText(MCF::TString &&strSetToWhich);
};
